| Conditions | 1 |
| Paths | 1 |
| Total Lines | 85 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | /** |
||
| 11 | describe("Testing Module", function() { |
||
| 12 | |||
| 13 | describe("Testing so function returns correct type", function() { |
||
| 14 | it("catchPhrase should return string", function() { |
||
| 15 | let module = new Module(); |
||
| 16 | |||
| 17 | assert("string", typeof(module.getCatchPrase())); |
||
| 18 | }); |
||
| 19 | |||
| 20 | it("joke should return string", function() { |
||
| 21 | let module = new Module(); |
||
| 22 | |||
| 23 | assert("string", typeof(module.getJoke())); |
||
| 24 | }); |
||
| 25 | |||
| 26 | it("quote should return string", function() { |
||
| 27 | let module = new Module(); |
||
| 28 | |||
| 29 | assert("string", typeof(module.getQuote())); |
||
| 30 | }); |
||
| 31 | |||
| 32 | it("asci should return string", function() { |
||
| 33 | let module = new Module(); |
||
| 34 | |||
| 35 | assert("string", typeof(module.getAsci())); |
||
| 36 | }); |
||
| 37 | }); |
||
| 38 | |||
| 39 | describe("Testing type of object in Module", function() { |
||
| 40 | it("checking 'catchPhrase'", function() { |
||
| 41 | let module = new Module(); |
||
| 42 | |||
| 43 | assert("object", typeof(module.catchPhrase)); |
||
| 44 | }); |
||
| 45 | |||
| 46 | it("checking 'asci'", function() { |
||
| 47 | let module = new Module(); |
||
| 48 | |||
| 49 | assert("object", typeof(module.asci)); |
||
| 50 | }); |
||
| 51 | |||
| 52 | it("checking 'joke'", function() { |
||
| 53 | let module = new Module(); |
||
| 54 | |||
| 55 | assert("object", typeof(module.joke)); |
||
| 56 | }); |
||
| 57 | |||
| 58 | it("checking 'quote'", function() { |
||
| 59 | let module = new Module(); |
||
| 60 | |||
| 61 | assert("object", typeof(module.quote)); |
||
| 62 | }); |
||
| 63 | |||
| 64 | }); |
||
| 65 | |||
| 66 | describe("Testing size", function() { |
||
| 67 | it("checking 'catchPhrase'", function() { |
||
| 68 | let module = new Module(); |
||
| 69 | |||
| 70 | assert.equal(6, module.getCatchPraseSize()); |
||
| 71 | }); |
||
| 72 | |||
| 73 | it("checking 'joke'", function() { |
||
| 74 | let module = new Module(); |
||
| 75 | |||
| 76 | assert.equal(2, module.getJokeSize()); |
||
| 77 | }); |
||
| 78 | |||
| 79 | it("checking 'quote'", function() { |
||
| 80 | let module = new Module(); |
||
| 81 | |||
| 82 | assert.equal(7, module.getQuoteSize()); |
||
| 83 | }); |
||
| 84 | |||
| 85 | it("checking 'asci'", function() { |
||
| 86 | let module = new Module(); |
||
| 87 | |||
| 88 | assert.equal(9, module.getAsciSize()); |
||
| 89 | }); |
||
| 90 | |||
| 91 | |||
| 92 | }); |
||
| 93 | |||
| 94 | |||
| 95 | }); |
||
| 96 |